#ifndef __OS_ERRNO_H__
#define __OS_ERRNO_H__

/* oserrno.h:
 * error code
 *
 * (C) Copyright 2013 Ramone de Castillon 
 * ramone.castillon@gmail.com
 * http://poker-botting.blogspot.fr/.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
#define OS_CLT_ERR_OK   0

#define OS_CLT_ERR_IMG  100
#define OS_CLT_ERR_TM   101
#define OS_CLT_ERR_BOT  102
#define OS_CLT_ERR_CTXT 103
#define OS_CLT_ERR_IA   104
#define OS_CLT_ERR_ACT  105

#define OS_CTXT_ERR_INVAL    150
#define OS_CTXT_ERR_COMPLETE 151
#define OS_CTXT_ERR_DEALER   152
#define OS_CTXT_ERR_PLAYER   153
#define OS_CTXT_ERR_BOARD    154
#define OS_CTXT_ERR_DUP    155
#define OS_CTXT_ERR_WAITPREFLOP 20
#define OS_CTXT_ERR_EAGAIN 22
#define OS_CTXT_ERR_TURN   23

static inline const char *stroserror(int err)
{
	switch(err) {
		case OS_CLT_ERR_OK:
			return "no error";

		case OS_CLT_ERR_IMG:
			return "invalid image";
		case OS_CLT_ERR_TM:
			return "bad TM file";
		case OS_CLT_ERR_BOT:
			return "bot init error";
		case OS_CLT_ERR_CTXT:
			return "internal context error";
		case OS_CLT_ERR_IA:
			return "bot's IA error";
		case OS_CLT_ERR_ACT:
			return "action error";

		case OS_CTXT_ERR_INVAL:
			return "invalid context";
		case OS_CTXT_ERR_COMPLETE:
			return "context fill error";
		case OS_CTXT_ERR_DEALER:
			return "dealer find error";
		case OS_CTXT_ERR_PLAYER:
			return "player load error";
		case OS_CTXT_ERR_BOARD:
			return "board load error";
		case OS_CTXT_ERR_WAITPREFLOP:
			return "wait preflop";
		case OS_CTXT_ERR_DUP:
			return "duplicate frame";
		case OS_CTXT_ERR_EAGAIN:
			return "eagain";
		case OS_CTXT_ERR_TURN:
			return "not our turn to play";

		default:
			return "unknown error";
	};
}

#endif

